package com.feidu.utils;

import java.util.Iterator;
import java.util.List;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.widget.Toast;

@SuppressLint("ShowToast")
public class CommonUtil {

	
	public static void makeText(Context mContext,String text){
		
		Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
	}
	
	/**
	 * 获取当前运行APP名称
	 * @param mContext
	 * @param pID
	 * @return
	 */
	private String getAppName(Context mContext,int pID) {
		String processName = null;
		ActivityManager am = (ActivityManager) mContext.getSystemService("ACTIVITY_SERVICE");
		List l = am.getRunningAppProcesses();
		Iterator i = l.iterator();
		PackageManager pm = mContext.getPackageManager();
		while (i.hasNext()) {
			ActivityManager.RunningAppProcessInfo info = (ActivityManager.RunningAppProcessInfo) (i.next());
			try {
				if (info.pid == pID) {
					processName = info.processName;
					return processName;
				}
			} catch (Exception e) {
				// Log.d("Process", "Error>> :"+ e.toString());
			}
		}
		return processName;
	}
}
